<template>
  <div id="teacherList">
    <h1>教师列表</h1>
    <el-table :data="teacherData" style="width: max-content">

      <el-table-column prop="name" label="教师名称" width="120"> </el-table-column>

      <el-table-column label="负责班级" width="100">
        <!-- <template slot-scope="scope" >
          <template v-for='item in scope.row.teachers'>
            <el-tag :key="item._id">{{item.name}}</el-tag>
          </template>
        </template> -->
      </el-table-column>

      <el-table-column label="操作" width="150">
        <template slot-scope="scope">
          <el-button size="mini" @click="handleEdit(scope.$index, scope.row)"
            >修改</el-button
          >
          <el-button
            size="mini"
            type="danger"
            @click="handleDelete(scope.$index, scope.row)"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { createNamespacedHelpers } from 'vuex';
const { mapState:teacherMapState, mapActions:teacherMapActions } = createNamespacedHelpers('teacher');

export default {
  data() {
    return {

    }
  },
  computed:{
    ...teacherMapState(['teacherData'])
  },
  mounted(){
    this.getTeacher();
  },
  methods: {
    ...teacherMapActions(['getTeacher'])
  },
};
</script>

<style scoped>
div#teacherList{
  display: flex;
  flex-direction: column;
  align-items: center;
}
</style>